package cn.mygweb.admin.modules.sys.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.mygweb.admin.modules.sys.mapper.UserRoleMapper;
import cn.mygweb.admin.modules.sys.pojo.UserRole;
import cn.mygweb.admin.modules.sys.service.UserRoleService;
import tk.mybatis.mapper.entity.Example;

/** 
* <p>Title: UserRoleServiceImpl.java</p>
* <p>Description: 用户-角色对应表的service实现类</p>  
* @author gxb 
* @date 2019年6月9日 
* <p>Copyright: Copyright (c) 2019</p>
* <p>Company: www.mygweb.cn</p> 
*/
@Service
public class UserRoleServiceImpl implements UserRoleService{

	@Autowired
	private UserRoleMapper userRoleMapper;
	
	/**
	 * <p>Title: queryByUid</p>
	 * <p>Description: 查询用户-角色信息</p>
	 * @param userRole
	 * @return
	 * @see cn.mygweb.admin.modules.sys.service.UserRoleService#queryByUid(cn.mygweb.admin.modules.sys.pojo.UserRole)
	 */
	@Override
	@Transactional(propagation=Propagation.SUPPORTS)
	public List<UserRole> queryUserRoleList(UserRole userRole) {
		Example example = new Example(UserRole.class);
		return userRoleMapper.selectByExample(example);
	}

	/**
	 * <p>Title: insertRMList</p>
	 * <p>Description: 插入用户-角色对应信息</p>
	 * @param urList
	 * @see cn.mygweb.admin.modules.sys.service.UserRoleService#insertRMList(java.util.List)
	 */
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void insertURList(List<UserRole> urList) {
		userRoleMapper.insertRMList(urList);
	}

	/**
	 * <p>Title: batchDeleteByUId</p>
	 * <p>Description: 通过uid批量删除信息</p>
	 * @param uid
	 * @see cn.mygweb.admin.modules.sys.service.UserRoleService#batchDeleteByUId(java.lang.String)
	 */
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public void batchDeleteByUId(String uid) {
		userRoleMapper.batchDeleteByUId(uid);
	}

}
